<?php
class Poll_Plugin_Menus
{
    public function onMenuInitialize_PollMainBrowse($row) {
        return array(
            'label' => Zend_Registry::get('Zend_Translate')->_($row->label),                                 
            'route' => 'poll_general',
            'params' => array(
                'controller' => 'poll',
                'action' => 'browse'
            )   
        );
    }
    
    public function onMenuInitialize_PollMainManage($row) {
        $viewer = Engine_Api::_()->user()->getViewer();
        if (!$viewer->getIdentity()) return NULL;
        return array(
              'label' => Zend_Registry::get('Zend_Translate')->_($row->label),                                 
              'route' => 'poll_general',
              'params' => array(
                'controller' => 'poll',
                'action' => 'manage'
              )
        );
    }
    
    public function onMenuInitialize_PollMainAsk($row) {
        $viewer = Engine_Api::_()->user()->getViewer();
        if (!$viewer->getIdentity()) return NULL;
        return array(
              'label' => Zend_Registry::get('Zend_Translate')->_($row->label),                                 
              'route' => 'poll_general',
              'params' => array(
                'controller' => 'poll',
                'action' => 'manage',
                'do' => 'create'
              )
        );
    }
}